
import axios from 'axios'

export function ajaxRequest(url, method, params) {
  return new Promise((resolve, reject) => {
    if (method === "POST" || method === "PUT") {
      axios.post(`${url}`,
      params
      ).then(res => {
        resolve(res.data);
      });
    } else {
      axios.get(url).then(res => {
        resolve(res.data);
      });
    }
  });
}

export const addExpense = (params) => {
  return ajaxRequest("/expense/add", "POST", params);
};


